Exemplo n.º 1
0
    def test_get_client_successfully(self):
        client = Client(name='TestClient', ip_address='172.0.15.3')
        db.session.add(client)
        db.session.commit()

        response = self.client.get('/clients/1')

        assert_success(response)
        response_json = response.get_json()
        self.assertEqual(response_json, client.details_json())
Exemplo n.º 2
0
 def test_details_json(self):
     client = Client(name=self.name, ip_address=self.ip_address, id=self.id)
     client.datasets = [
         Dataset(filename='foo.bar', id=1),
         Dataset(filename='test', id=3)
     ]
     self.assertDictEqual(
         client.details_json(), {
             'name': self.name,
             'ip_address': self.ip_address,
             'id': self.id,
             'datasets': [1, 3]
         })