|
24 | 24 | return_value=FAKE_URI, |
25 | 25 | ) |
26 | 26 |
|
27 | | - |
28 | | -# ── mayhem=False, cashback=False (default) ────────────────────────────── |
29 | | - |
30 | | - |
31 | | -@pytest.mark.asyncio |
32 | | -@_UPLOAD_PATCH |
33 | | -async def test_launch_default( |
34 | | - _mock_upload, surfpool_rpc, funded_keypair, test_keystore, test_password |
35 | | -): |
36 | | - """Launch with defaults: no mayhem, no cashback.""" |
37 | | - result = await launch_token( |
38 | | - rpc_url=surfpool_rpc, |
39 | | - keystore_path=str(test_keystore), |
40 | | - password=test_password, |
41 | | - name="Default", |
42 | | - ticker="DFLT", |
43 | | - description="default launch", |
44 | | - ) |
45 | | - |
46 | | - assert "error" not in result, f"Launch failed: {result}" |
47 | | - assert result["action"] == "launch" |
48 | | - assert result["is_cashback"] is False |
49 | | - assert result["signature"] |
50 | | - |
51 | | - info = await get_token_info(surfpool_rpc, result["mint"]) |
52 | | - assert "error" not in info, f"Token not found: {info}" |
53 | | - assert info["graduated"] is False |
54 | | - |
55 | | - |
56 | | -# ── mayhem=False, cashback=True ───────────────────────────────────────── |
| 27 | +_LAUNCH_MATRIX = [ |
| 28 | + pytest.param(False, False, None, id="default"), |
| 29 | + pytest.param(False, True, None, id="cashback"), |
| 30 | + pytest.param(True, False, None, id="mayhem"), |
| 31 | + pytest.param(True, True, None, id="mayhem+cashback"), |
| 32 | + pytest.param(False, False, 0.001, id="default+buy"), |
| 33 | + pytest.param(False, True, 0.001, id="cashback+buy"), |
| 34 | + pytest.param(True, False, 0.001, id="mayhem+buy"), |
| 35 | + pytest.param(True, True, 0.001, id="mayhem+cashback+buy"), |
| 36 | +] |
57 | 37 |
|
58 | 38 |
|
59 | 39 | @pytest.mark.asyncio |
| 40 | +@pytest.mark.parametrize("is_mayhem,is_cashback,initial_buy_sol", _LAUNCH_MATRIX) |
60 | 41 | @_UPLOAD_PATCH |
61 | | -async def test_launch_cashback( |
62 | | - _mock_upload, surfpool_rpc, funded_keypair, test_keystore, test_password |
| 42 | +async def test_launch( |
| 43 | + _mock_upload, |
| 44 | + surfpool_rpc, |
| 45 | + funded_keypair, |
| 46 | + test_keystore, |
| 47 | + test_password, |
| 48 | + is_mayhem, |
| 49 | + is_cashback, |
| 50 | + initial_buy_sol, |
63 | 51 | ): |
64 | | - """Launch with cashback enabled, no mayhem.""" |
65 | | - result = await launch_token( |
66 | | - rpc_url=surfpool_rpc, |
67 | | - keystore_path=str(test_keystore), |
68 | | - password=test_password, |
69 | | - name="Cashback", |
70 | | - ticker="CSHB", |
71 | | - description="cashback launch", |
72 | | - is_cashback=True, |
73 | | - ) |
74 | | - |
75 | | - assert "error" not in result, f"Launch failed: {result}" |
76 | | - assert result["is_cashback"] is True |
77 | | - assert result["signature"] |
78 | | - |
79 | | - info = await get_token_info(surfpool_rpc, result["mint"]) |
80 | | - assert "error" not in info, f"Token not found: {info}" |
81 | | - assert info["graduated"] is False |
82 | | - |
83 | | - |
84 | | -# ── mayhem=True, cashback=False ───────────────────────────────────────── |
| 52 | + """Launch token with given mayhem/cashback/buy combination.""" |
| 53 | + kwargs = {} |
| 54 | + if is_mayhem: |
| 55 | + kwargs["is_mayhem"] = True |
| 56 | + if is_cashback: |
| 57 | + kwargs["is_cashback"] = True |
| 58 | + if initial_buy_sol is not None: |
| 59 | + kwargs["initial_buy_sol"] = initial_buy_sol |
85 | 60 |
|
86 | | - |
87 | | -@pytest.mark.asyncio |
88 | | -@_UPLOAD_PATCH |
89 | | -async def test_launch_mayhem( |
90 | | - _mock_upload, surfpool_rpc, funded_keypair, test_keystore, test_password |
91 | | -): |
92 | | - """Launch with mayhem enabled, no cashback.""" |
93 | 61 | result = await launch_token( |
94 | 62 | rpc_url=surfpool_rpc, |
95 | 63 | keystore_path=str(test_keystore), |
96 | 64 | password=test_password, |
97 | | - name="Mayhem", |
98 | | - ticker="MYHM", |
99 | | - description="mayhem launch", |
100 | | - is_mayhem=True, |
| 65 | + name="Test", |
| 66 | + ticker="TST", |
| 67 | + description="parametrized launch", |
| 68 | + **kwargs, |
101 | 69 | ) |
102 | 70 |
|
103 | 71 | assert "error" not in result, f"Launch failed: {result}" |
104 | | - assert result["is_cashback"] is False |
| 72 | + assert result["action"] == "launch" |
| 73 | + assert result["is_cashback"] is is_cashback |
105 | 74 | assert result["signature"] |
106 | 75 |
|
107 | | - info = await get_token_info(surfpool_rpc, result["mint"]) |
108 | | - assert "error" not in info, f"Token not found: {info}" |
109 | | - assert info["graduated"] is False |
110 | | - |
111 | | - |
112 | | -# ── mayhem=True, cashback=True ────────────────────────────────────────── |
113 | | - |
114 | | - |
115 | | -@pytest.mark.asyncio |
116 | | -@_UPLOAD_PATCH |
117 | | -async def test_launch_mayhem_cashback( |
118 | | - _mock_upload, surfpool_rpc, funded_keypair, test_keystore, test_password |
119 | | -): |
120 | | - """Launch with both mayhem and cashback enabled.""" |
121 | | - result = await launch_token( |
122 | | - rpc_url=surfpool_rpc, |
123 | | - keystore_path=str(test_keystore), |
124 | | - password=test_password, |
125 | | - name="MayhemCB", |
126 | | - ticker="MHCB", |
127 | | - description="mayhem + cashback launch", |
128 | | - is_mayhem=True, |
129 | | - is_cashback=True, |
130 | | - ) |
131 | | - |
132 | | - assert "error" not in result, f"Launch failed: {result}" |
133 | | - assert result["is_cashback"] is True |
134 | | - assert result["signature"] |
| 76 | + if initial_buy_sol is not None: |
| 77 | + assert result["initial_buy_sol"] == initial_buy_sol |
135 | 78 |
|
136 | 79 | info = await get_token_info(surfpool_rpc, result["mint"]) |
137 | 80 | assert "error" not in info, f"Token not found: {info}" |
138 | 81 | assert info["graduated"] is False |
139 | | - |
140 | | - |
141 | | -# ── with initial buy ──────────────────────────────────────────────────── |
142 | | - |
143 | | - |
144 | | -@pytest.mark.asyncio |
145 | | -@_UPLOAD_PATCH |
146 | | -async def test_launch_default_with_buy( |
147 | | - _mock_upload, surfpool_rpc, funded_keypair, test_keystore, test_password |
148 | | -): |
149 | | - """Launch with initial buy, no mayhem, no cashback.""" |
150 | | - result = await launch_token( |
151 | | - rpc_url=surfpool_rpc, |
152 | | - keystore_path=str(test_keystore), |
153 | | - password=test_password, |
154 | | - name="DefBuy", |
155 | | - ticker="DBUY", |
156 | | - description="default + buy", |
157 | | - initial_buy_sol=0.001, |
158 | | - ) |
159 | | - |
160 | | - assert "error" not in result, f"Launch failed: {result}" |
161 | | - assert result["initial_buy_sol"] == 0.001 |
162 | | - assert result["signature"] |
163 | | - |
164 | | - |
165 | | -@pytest.mark.asyncio |
166 | | -@_UPLOAD_PATCH |
167 | | -async def test_launch_cashback_with_buy( |
168 | | - _mock_upload, surfpool_rpc, funded_keypair, test_keystore, test_password |
169 | | -): |
170 | | - """Launch cashback token with initial buy.""" |
171 | | - result = await launch_token( |
172 | | - rpc_url=surfpool_rpc, |
173 | | - keystore_path=str(test_keystore), |
174 | | - password=test_password, |
175 | | - name="CashBuy", |
176 | | - ticker="CBUY", |
177 | | - description="cashback + buy", |
178 | | - is_cashback=True, |
179 | | - initial_buy_sol=0.001, |
180 | | - ) |
181 | | - |
182 | | - assert "error" not in result, f"Launch failed: {result}" |
183 | | - assert result["is_cashback"] is True |
184 | | - assert result["initial_buy_sol"] == 0.001 |
185 | | - assert result["signature"] |
186 | | - |
187 | | - |
188 | | -@pytest.mark.asyncio |
189 | | -@_UPLOAD_PATCH |
190 | | -async def test_launch_mayhem_with_buy( |
191 | | - _mock_upload, surfpool_rpc, funded_keypair, test_keystore, test_password |
192 | | -): |
193 | | - """Launch mayhem token with initial buy.""" |
194 | | - result = await launch_token( |
195 | | - rpc_url=surfpool_rpc, |
196 | | - keystore_path=str(test_keystore), |
197 | | - password=test_password, |
198 | | - name="MyhBuy", |
199 | | - ticker="MBUY", |
200 | | - description="mayhem + buy", |
201 | | - is_mayhem=True, |
202 | | - initial_buy_sol=0.001, |
203 | | - ) |
204 | | - |
205 | | - assert "error" not in result, f"Launch failed: {result}" |
206 | | - assert result["initial_buy_sol"] == 0.001 |
207 | | - assert result["signature"] |
208 | | - |
209 | | - |
210 | | -@pytest.mark.asyncio |
211 | | -@_UPLOAD_PATCH |
212 | | -async def test_launch_mayhem_cashback_with_buy( |
213 | | - _mock_upload, surfpool_rpc, funded_keypair, test_keystore, test_password |
214 | | -): |
215 | | - """Launch mayhem + cashback token with initial buy.""" |
216 | | - result = await launch_token( |
217 | | - rpc_url=surfpool_rpc, |
218 | | - keystore_path=str(test_keystore), |
219 | | - password=test_password, |
220 | | - name="MhCbBuy", |
221 | | - ticker="MCBB", |
222 | | - description="mayhem + cashback + buy", |
223 | | - is_mayhem=True, |
224 | | - is_cashback=True, |
225 | | - initial_buy_sol=0.001, |
226 | | - ) |
227 | | - |
228 | | - assert "error" not in result, f"Launch failed: {result}" |
229 | | - assert result["is_cashback"] is True |
230 | | - assert result["initial_buy_sol"] == 0.001 |
231 | | - assert result["signature"] |
0 commit comments