Přejít na obsah
Menu
You need to be registered to interact with the community.
This question has been flagged
2684 Zobrazení

Getting this error while doing unit test for external API


class TestApi(common.TransactionCase):
def setUp(self):
super(TestApi, self).setUp()
self.password = "admin1"
self.user = new_test_user(self.env, login="admin1", password=self.password)


def test_check_associate(self):
params = {
"db": self.env.cr.dbname,
"login": self.user.login,
"password": self.password,
}
url = "http://{}:{}{}".format(HOST, PORT, "/api/auth/token")
response = self.opener.post(url, json=params)
self.assertEqual(response.status_code, 200)
self.assertEqual(response.headers["Content-Type"], "application/json")
data = response.json()
session = root.session_store.get(data["session"]["sid"])
self.assertEqual(session.login, 'admin')


Avatar
Zrušit
Related Posts Odpovědi Zobrazení Aktivita
1
kvě 24
3328
2
říj 23
2661
1
dub 24
27109
1
lis 22
2717
2
čvc 22
3471