|
|
@ -300,3 +300,47 @@ class TestGet(TestCase): |
|
|
|
result = client.put('/api/v1/bikes/{bike_id}/purchase/'.format(bike_id=bike.id), data={'member': member.id}, format='json') |
|
|
|
|
|
|
|
self.assertEqual(result.status_code, status.HTTP_400_BAD_REQUEST) |
|
|
|
|
|
|
|
def test_scrap_transition(self): |
|
|
|
data = { |
|
|
|
"colour": "black", |
|
|
|
"make": "Miyata", |
|
|
|
"serial_number": "12345676", |
|
|
|
"source": Bike.COS_BIKE_DIVERSION_PILOT, |
|
|
|
"donated_by": "Greg", |
|
|
|
"donated_at": "2017-01-01", |
|
|
|
"size": Bike.SMALL, |
|
|
|
"price": Decimal('68.00'), |
|
|
|
"state": BikeState.ASSESSED, |
|
|
|
"stolen": False, |
|
|
|
"cpic_searched_at": timezone.now(), |
|
|
|
"stripped": False |
|
|
|
} |
|
|
|
bike = Bike.objects.create(**data) |
|
|
|
client = APIClient() |
|
|
|
client.force_authenticate(user=self.user, token='blah') |
|
|
|
result = client.put(f'/api/v1/bikes/{bike.id}/scrap/') |
|
|
|
|
|
|
|
self.assertEqual(result.status_code, status.HTTP_200_OK) |
|
|
|
|
|
|
|
def test_transfer_to_police_transition(self): |
|
|
|
data = { |
|
|
|
"colour": "black", |
|
|
|
"make": "Miyata", |
|
|
|
"serial_number": "12345676", |
|
|
|
"source": Bike.COS_BIKE_DIVERSION_PILOT, |
|
|
|
"donated_by": "Greg", |
|
|
|
"donated_at": "2017-01-01", |
|
|
|
"size": Bike.SMALL, |
|
|
|
"price": Decimal('68.00'), |
|
|
|
"state": BikeState.ASSESSED, |
|
|
|
"stolen": False, |
|
|
|
"cpic_searched_at": timezone.now(), |
|
|
|
"stolen": True |
|
|
|
} |
|
|
|
bike = Bike.objects.create(**data) |
|
|
|
client = APIClient() |
|
|
|
client.force_authenticate(user=self.user, token='blah') |
|
|
|
result = client.put(f'/api/v1/bikes/{bike.id}/stolen/') |
|
|
|
|
|
|
|
self.assertEqual(result.status_code, status.HTTP_200_OK) |
|
|
|