Пример #1
0
 def test_execute_set_mode(self):
     action = Execute()
     action.set_mode(ActionMode.SECONDARY)
     self.assertDictEqual(action.as_data(), {
         "type": "Action.Execute",
         "mode": "secondary"
     })
Пример #2
0
 def test_execute_set_tooltip(self):
     action = Execute()
     action.set_tooltip("Maecenas consequat")
     self.assertDictEqual(action.as_data(), {
         "type": "Action.Execute",
         "tooltip": "Maecenas consequat"
     })
Пример #3
0
 def test_execute_set_is_enabled(self):
     action = Execute()
     action.set_is_enabled(False)
     self.assertDictEqual(action.as_data(), {
         "type": "Action.Execute",
         "isEnabled": False
     })
Пример #4
0
 def test_execute_set_style(self):
     action = Execute()
     action.set_style(ActionStyle.POSITIVE)
     self.assertDictEqual(action.as_data(), {
         "type": "Action.Execute",
         "style": "positive"
     })
Пример #5
0
 def test_execute_set_set_fallback1(self):
     action = Execute()
     action.set_fallback(FallbackOption.DROP)
     self.assertDictEqual(action.as_data(), {
         "type": "Action.Execute",
         "fallback": "drop"
     })
Пример #6
0
 def test_execute_set_icon_url(self):
     action = Execute()
     action.set_icon_url(URL + "image.bmp")
     self.assertDictEqual(action.as_data(), {
         "type": "Action.Execute",
         "iconUrl": URL + "image.bmp"
     })
Пример #7
0
 def test_execute_set_title(self):
     action = Execute()
     action.set_title("foo")
     self.assertDictEqual(action.as_data(), {
         "type": "Action.Execute",
         "title": "foo"
     })
Пример #8
0
 def test_execute_set_associated_inputs(self):
     action = Execute()
     action.set_associated_inputs(AssociatedInputs.NONE)
     self.assertDictEqual(action.as_data(), {
         "type": "Action.Execute",
         "associatedInputs": "None"
     })
Пример #9
0
 def test_execute(self):
     action = Execute(verb="verb",
                      data="data",
                      associated_inputs=AssociatedInputs.AUTO,
                      title="title",
                      icon_url=URL + "image.bmp",
                      style=ActionStyle.DESTRUCTIVE,
                      fallback=FallbackOption.DROP,
                      tooltip="Fusce eget rutrum",
                      is_enabled=True,
                      mode=ActionMode.PRIMARY,
                      requires={"foo": "bar"})
     self.assertDictEqual(
         action.as_data(), {
             "type": "Action.Execute",
             "verb": "verb",
             "data": "data",
             "associatedInputs": "Auto",
             "title": "title",
             "iconUrl": URL + "image.bmp",
             "style": "destructive",
             "fallback": "drop",
             "tooltip": "Fusce eget rutrum",
             "isEnabled": True,
             "mode": "primary",
             "requires": {
                 "foo": "bar"
             }
         })
Пример #10
0
 def test_execute_set_requires(self):
     action = Execute()
     action.set_requires({"foo": "bar"})
     self.assertDictEqual(action.as_data(), {
         "type": "Action.Execute",
         "requires": {
             "foo": "bar"
         }
     })
Пример #11
0
 def test_execute_set_set_fallback2(self):
     action = Execute()
     action.set_fallback(Image(URL))
     self.assertDictEqual(action.as_data(), {
         "type": "Action.Execute",
         "fallback": {
             "type": "Image",
             "url": URL
         }
     })
 def test_refresh_set_action(self):
     refresh = Refresh()
     refresh.set_action(Execute())
     self.assertDictEqual(refresh.as_data(),
                          {"action": {
                              "type": "Action.Execute"
                          }})
 def test_refresh(self):
     refresh = Refresh(action=Execute(), user_ids=["user_1", "user_2"])
     self.assertDictEqual(refresh.as_data(), {
         "action": {
             "type": "Action.Execute"
         },
         "userIds": ["user_1", "user_2"]
     })
Пример #14
0
 def test_execute_set_set_fallback3(self):
     action = Execute()
     with self.assertRaisesMessage(CardException, "Invalid fallback type"):
         action.set_fallback(1)
Пример #15
0
 def test_execute_empty(self):
     action = Execute()
     self.assertDictEqual(action.as_data(), {"type": "Action.Execute"})