Beispiel #1
0
    def setUp(self):
        UICase.setUp(self)
        self.login()

        self.created_at = now()

        self.created_on_str = format_date(self.created_at)
        self.one_day_after_str = format_date(self.created_at +
                                             timedelta(days=1))
        self.one_day_before_str = format_date(self.created_at -
                                              timedelta(days=1))
        self.one_week_after_str = format_date(self.created_at +
                                              timedelta(days=7))
        self.one_week_before_str = format_date(self.created_at -
                                               timedelta(days=7))

        self.contents = (
            'I need a bike. I like Honda.',  # needs, likes
            'Can somebody recommend a sturdy laptop?',  # consideration
            'I need an affordabl laptop. And a laptop bag',  # needs
            'Whatever you buy, let it be an Apple laptop',  # recommendation
            'I would like to have a thin and lightweight laptop.',  # needs
            'Thank you very much!',  # gratitude
            'You\'re gonna end up with a broken laptop'  # problem
        )
        self.setup_posts()
Beispiel #2
0
 def setUp(self):
     UICase.setUp(self)
     self.account = Account.objects.create(name='solariat_test')
     self.account.add_perm(self.user)
     self.user.account = self.account
     self.user.save()
     self.login()
Beispiel #3
0
    def setUp(self):
        UICase.setUp(self)
        self.login()

        # Set to auto respond
        self.channel.response_enabled = True
        self.channel.save()
        self.bookmark1 = create_bookmark(self.user, self.channel)
        self.bookmark2 = create_bookmark(self.user, self.channel)
Beispiel #4
0
    def setUp(self):
        UICase.setUp(self)
        self.login()

        # Create User Tracking Channels
        self.ut1 = self._create_user_tracking_channel('user_tracker_1', ['u1', 'u2'])
        self.ut2 = self._create_user_tracking_channel('user_tracker_2', ['u2', 'u3'])
        self.kw1 = self._create_keyword_tracking_channel('kw_tracker_1', ['k1', 'k2'])
        self.kw2 = self._create_keyword_tracking_channel('kw_tracker_2', ['k2', 'k3'])
        self.etc = self._create_enterprise_twitter_channel('etc_1', 'twr1')
Beispiel #5
0
    def setUp(self):
        UICase.setUp(self)
        self.login()

        self.account = Account.objects.create(name='solariat_test')
        self.account.add_perm(self.user)

        self.user2 = self._create_db_user(email='*****@*****.**',
                                          account='Account2',
                                          roles=[AGENT])
        self.account2 = self.user2.account
Beispiel #6
0
 def setUp(self):
     UICase.setUp(self)
     self.login()
     self.user.account.update(available_apps=CONFIGURABLE_APPS,
                              selected_app=APP_PREDICTORS)
     self.smart_tag = SmartTagChannel.objects.create_by_user(
         self.user,
         title="test_smart_tag",
         parent_channel=self.channel.id,
         account=self.channel.account)
     self.jobs_origin_transport = jobs_config.transport
     self.setup_jobs_transport('serial')
     self._setUp()
 def setUp(self):
     UICase.setUp(self)
     self.login()
     self.efc = EnterpriseFacebookChannel.objects.create_by_user(
         self.user, title='OUT_FC', account=self.user.account)
     self.fsc = FacebookServiceChannel.objects.create_by_user(
         self.user, title='INB1', account=self.user.account)
     self.group = {'id': 'group_id', 'name': 'group_name'}
     self.event = {'id': 'event_id', 'name': 'event_name'}
     self.page = {
         'id': 'page_id',
         'name': 'test_page',
         'access_token': 'fake_token'
     }
Beispiel #8
0
    def setUp(self):
        UICase.setUp(self)
        self.login()

        self._create_db_post(
            channel=self.channel,
            content="I need a new laptop"
        )
        self._create_db_post(
            channel=self.channel,
            content="Can somebody recommend a good pair of jeans?"
        )
        self.post = self._create_db_post(
            channel=self.channel,
            content='I need a bike . I like Honda .'
        )
        self.speech_act_id = 0
Beispiel #9
0
    def setUp(self):
        UICase.setUp(self)
        self.login()

        self.na_acct = Account.objects.create(name="NotAccessible")

        self.accounts = [
            Account.objects.create(name="Acct1"),
            Account.objects.create(name="Acct2")
        ]

        for a in self.accounts:
            a.add_user(self.user)
        self.user.current_account = self.accounts[0]

        self.su = self._create_db_user(email="*****@*****.**",
                                       roles=[STAFF])
        self.su.is_superuser = True
        self.su.save()
Beispiel #10
0
    def setUp(self):
        UICase.setUp(self)
        self.login()
        self.post = self._create_db_post('I need a laptop bag',
                                         demand_matchables=True)

        from solariat_bottle.db.account import Account
        self.account1 = Account.objects.create(name='Acct1')

        for ch in Channel.objects.find_by_user(self.user):
            ch.account = self.account1
            ch.save()
            # Account switching now means we need to refresh permissions on this new account
            ch.add_perm(self.user)

        self.account1.add_user(self.user)
        self.user.current_account = self.account1
        self.user.reload()
        self.account2 = Account.objects.create(name='Acct2')
Beispiel #11
0
    def setUp(self):
        UICase.setUp(self)
        self.login()
        first_date = utc(datetime(2012, 1, 1))
        post1 = self._create_db_post(_created=first_date,
                                     content='i need some carrot')
        self.assertEqual(
            Post.objects(channels__in=[self.channel.id]).count(), 1)

        # 1 jan + 10 minutes
        second_date = first_date + timedelta(minutes=10)
        post2 = self._create_db_post(_created=second_date,
                                     content='where i can buy a carrot?')
        self.assertEqual(
            Post.objects(channels__in=[self.channel.id]).count(), 2)

        # 1 jan + 7 days
        third_date = first_date + timedelta(minutes=7 * 60 * 24)
        post3 = self._create_db_post(_created=third_date,
                                     content='i need some carrot')
        self.assertEqual(
            Post.objects(channels__in=[self.channel.id]).count(), 3)

        forth_date = third_date + timedelta(minutes=10)
        post4 = self._create_db_post(_created=forth_date,
                                     content='where i can buy a carrot?')
        self.assertEqual(
            Post.objects(channels__in=[self.channel.id]).count(), 4)

        # This will not be created, only for stats
        post5 = Post(channels=[self.channel.id],
                     content='LOL',
                     actor_id=post4.user_profile.id,
                     is_inbound=True,
                     _native_id='1',
                     _created=post4._created)
        self.assertEqual(
            Post.objects(channels__in=[self.channel.id]).count(), 4)
        no_post_created(post5, utc(forth_date + timedelta(minutes=10)))
        self.now = now()
    def setUp(self):
        UICase.setUp(self)
        self.login()
        #self.user.is_superuser = False
        #self.user.save()

        self.outbound = ETC.objects.create_by_user(
            self.user,
            title='Compliance Review Outbound',
            access_token_key='dummy_key',
            access_token_secret='dummy_secret')

        self.account.outbound_channels = {'Twitter': str(self.outbound.id)}
        self.account.save()

        self.channel = KTC.objects.create_by_user(self.user,
                                                  title='Inbound Channel',
                                                  keywords=['foo'])

        self.matchable = self._create_db_matchable('there is some foo')

        # Create another user and grant them access
        self.team_user = self._create_db_user(account=self.account,
                                              email='*****@*****.**',
                                              password='******',
                                              roles=[AGENT])

        post = self._create_db_post('I need some foo',
                                    demand_matchables=True,
                                    twitter={'id': fake_status_id()})

        self.response = Response.objects.upsert_from_post(post)

        self.assertEqual(self.response.channel, self.channel)

        self.outbound.review_outbound = True
        self.outbound.save()
        review_team = self.outbound.get_review_team()
        review_team.add_user(self.team_user)
        self.outbound.add_perm(self.team_user)
 def setUp(self):
     UICase.setUp(self)
     self.account.update(account_type='GSE')
     self.sc = FacebookServiceChannel.objects.create_by_user(
         self.user, title='Service Channel')
     self.inbound = self.sc.inbound_channel
Beispiel #14
0
 def setUp(self):
     UICase.setUp(self)
     self.login()
     pass
Beispiel #15
0
 def tearDown(self):
     self.setup_jobs_transport(self.jobs_origin_transport)
     return UICase.tearDown(self)
 def setUp(self):
     UICase.setUp(self)
     self.login()
     self.post = self._create_db_post('I do not like laptop bag',
                                      demand_matchables=True)
Beispiel #17
0
 def setUp(self):
     UICase.setUp(self)
     self.login()
     self.account = Account.objects.create(name="Test-Delete")
     self.account.add_perm(self.user)