Esempio n. 1
0
 def test_json(self):
     client = Client(name=self.name, ip_address=self.ip_address, id=self.id)
     self.assertDictEqual(client.json(), {
         'name': self.name,
         'ip_address': self.ip_address,
         'id': self.id
     })
    def test_get_one_element_clients_list(self):
        client = Client(name='Foo', ip_address='127.0.0.1')
        db.session.add(client)
        db.session.commit()

        response = self.client.get('/clients')
        response_json = response.get_json()
        assert_success(response)
        self.assertEqual(len(response_json), 1)
        self.assertDictEqual(response_json[0], client.json())