Beispiel #1
0
class NikiInterestTest(TestCase):
    def setUp(self):
        now = datetime.datetime.today()
        InterestAccount.objects.create(username="******", password="******", lastUpdate=now)
        self.account = InterestAccount.objects.get(username="******")
        self.manager = InterestManager()
        self.project_id = "89CCAA70-1844-E011-A130-005056AA000E"
        self.factory = RequestFactory()

    def test_getIdsByProjectFrom(self):
        from_date = datetime.datetime.today() - datetime.timedelta(days=14)
        ids = self.manager.getIdsByProjectFrom(self.account, self.project_id, from_date)
        self.assertNotEqual(None, ids, "ids was none")

    def test_getIdsByProject(self):
        ids = self.manager.getIdsByProject(self.account, self.project_id)
        self.assertNotEqual(None, ids, "ids was none")

    def test_getByIds(self):
        ids = self.manager.getIdsByProject(self.account, self.project_id)
        result = self.manager.getByIds(self.account, ids)
        self.assertIsNotNone(result, "result was None")

    def test_niki_interest_subscription_dates(self):
        startstr = "20140801"
        endstr = "20141001"
        request = self.factory.get(
            "/cyfe/niki/subscriptions/?project={}&start_date={}&end_date={}".format(self.project_id, startstr, endstr)
        )
        # Test my_view() as if it were deployed at /customer/details
        response = request
        self.assertEqual(response.status_code, 200)
Beispiel #2
0
 def setUp(self):
     now = datetime.datetime.today()
     InterestAccount.objects.create(username="******", password="******", lastUpdate=now)
     self.account = InterestAccount.objects.get(username="******")
     self.manager = InterestManager()
     self.project_id = "89CCAA70-1844-E011-A130-005056AA000E"
     self.factory = RequestFactory()